// JS 是表现力极强的语言

let liuyu = {
    name:'刘钰',
    sex:'男',
    hasGirlFriend:false,
    hometown:'赣州',
    room:'学校'
}

const childern = [];

console.log(typeof liuyu);

class Person{
    constructor(name,sex){
        this.name = name;
        this.sex = sex;
        if(childern.length>=2){
            console.log('感谢您为国家做贡献！')
        }

    }
}

const child1 = new Person('liu11','男');
childern.push(child1);
const child2 = new Person('liu2');
childern.push(child2);
const child3 = new Person('liu3');
childern.push(child3);

console.log(childern,typeof childern);

// 通过id获取html文件中的标签
const ele = document.getElementById('user');

// 使用js创建一个div标签
const personEle = document.createElement('div');

// innerText :新建div内建立一个文本
personEle.innerText =
     liuyu.name + ' ' + liuyu.sex + "\n" + liuyu.hometown + "\n " + liuyu.hasGirlFriend;

// innerHTML :'user'标识的div内建立html标签
ele.innerHTML = `
    <div>person:${liuyu.name}</div>
`
//将personEle节点作为ele的节点
ele.appendChild(personEle)

